﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace lcmyjobs.Web.findjobs
{
    public partial class ListVipJobs : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lcmyjobs.BLL.adverts ad = new BLL.adverts();
                DataSet ds;
                ds = ad.GetAdvnid(26);
                if (ds.Tables[0].Rows.Count == 1)
                {


                    HyperLink2.ImageUrl = "~" + ds.Tables[0].Rows[0][0].ToString();
                    HyperLink2.NavigateUrl = ds.Tables[0].Rows[0][1].ToString();


                }
                if (!string.IsNullOrEmpty(Request["enterprise_bid"]))
                {
                    int bid = Convert.ToInt32(Request["enterprise_bid"]);

                    if (new lcmyjobs.BLL.enterprise_basic().UpdateBcount(bid))
                    {
                        Bind(bid);
                    }
                }

                this.Title = string.Format("{0}-{2}", Application["webname"].ToString(), Application["webregion"].ToString(), this.lbl_name.Text);

            }
        }

        private void Bind(int enterprise_bid)
        {
            lcmyjobs.BLL.enterprise_basic eb = new BLL.enterprise_basic();

            DataSet ds = eb.GetReleaseJobByBid(enterprise_bid);

            DataTable dt_b = ds.Tables[0];
            DataTable dt_t = ds.Tables[1];
            DataTable dt_j = ds.Tables[2];

            this.lbl_area.Text = dt_b.Rows[0]["area_name"].ToString();
            this.lbl_bh.Text = "单位编号：" + dt_b.Rows[0]["enterprise_bid"].ToString().PadLeft(6, '0');
            this.lbl_clnf.Text = dt_b.Rows[0]["clnf"].ToString();
            this.lbl_dwgm.Text = dt_b.Rows[0]["dwgm"].ToString();
            this.lbl_dwjj.Text = dt_b.Rows[0]["about"].ToString();
            this.lbl_dwxz.Text = dt_b.Rows[0]["dwxz"].ToString();
            this.lbl_name.Text = dt_b.Rows[0]["name"].ToString();

            foreach (DataRow row in dt_t.Rows)
            {
                this.lbl_trade.Text += " " + row["tradename"];
            }

            this.GridView1.DataSource = dt_j;
            this.GridView1.DataBind();
        }
    }
}